__author__ = 'suphawking'
import multiprocessing
def adder(pipe):
    server_p,client_p = pipe
    client_p.close()
    while True:
        try:
            x,y = server_p.recv()
        except EOFError:
            break
        result = x + y
        server_p.send(result)
    server_p.close()

if __name__ =='__main__':
    (server_P,client_p) = multiprocessing.Pipe()
    adder_p = multiprocessing.Process(target=adder,args=((server_P,client_p),))
    adder_p.start()
    server_P.close()
    client_p.send((3,4))
    print(client_p.recv())
    client_p.send(('hello','world'))
    print(client_p.recv())
    client_p.close()
    adder_p.join()